package com.ywz.project.system.controller;

import com.ywz.common.ResultResp;
import com.ywz.project.base.system.entity.TLabel;
import com.ywz.project.system.dto.req.EditLabelReq;
import com.ywz.project.system.dto.req.LabelPageReq;
import com.ywz.project.system.service.LabelApiService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 类描述 -> 标签API
 *
 * @Author: ywz
 * @Date: 2024/11/22
 */
@Api(tags = "标签API")
@RestController
@RequestMapping("/system/label")
public class LabelApiController {
    @Resource
    private LabelApiService labelApiService;

    /**
     * 方法描述 -> 获取所有标签列表
     *
     * @param type 标签类型
     * @Author: ywz
     * @Date: 2024/11/23
     */
    @GetMapping("/getLabelListByType")
    @ApiOperation(value = "根据类型获取标签列表", httpMethod = "GET")
    public ResultResp getLabelListByType(String type) {
        return labelApiService.getLabelListByType(type);
    }

    /**
     * 方法描述 -> 获取标签分页列表
     *
     * @param req 标签分页请求
     * @Author: ywz
     * @Date: 2024/11/23
     */
    @GetMapping("/getLabelPage")
    @ApiOperation(value = "获取标签分页列表", httpMethod = "GET")
    public ResultResp getLabelPage(LabelPageReq req){
        return labelApiService.getLabelPage(req);
    }

    /**
     * 方法描述 -> 新增编辑标签
     *
     * @param req 标签请求
     * @Author: ywz
     * @Date: 2024/11/23
     */
    @PostMapping("/editLabel")
    @ApiOperation(value = "编辑标签", httpMethod = "POST")
    public ResultResp editLabel(EditLabelReq req){
        return labelApiService.editLabel(req);
    }

    /**
     * 方法描述 -> 删除标签
     *
     * @param ids 标签ID
     * @Author: ywz
     * @Date: 2024/11/23
     */
    @DeleteMapping("/removeLabel")
    @ApiOperation(value = "删除标签", httpMethod = "DELETE")
    public ResultResp removeLabel(String ids){
        return labelApiService.removeLabel(ids);
    }
}
